﻿// ParseLib - An open source library for natural language processing.
// Copyright (C) Kais Dukes, 2012. E-mail: kais@kaisdukes.com
// http://parselib.org

using System.IO;
using ParseLib.Experiments;

namespace ParseLib.Tests
{
    public static class TestData
    {
        public static Experiment GetExperiment(string path)
        {
            using (var stream = OpenResource(path))
            {
                return Experiment.Read(stream);
            }
        }

        public static Stream OpenResource(string path)
        {
            var type = typeof (TestData);
            var stream = type.Assembly.GetManifestResourceStream(type, path.Replace('/', '.'));
            if (stream == null)
            {
                throw new ParseLibException("Failed to load resource: {0}", path);
            }
            return stream;
        }
    }
}
